package org.chickymate.server.controller.command.json;

import org.chickymate.server.controller.RequestWrapper;
import org.json.JSONException;
import org.json.JSONObject;

public class VoteCommentCommand extends JSONAbstractCommand {

	@Override
	protected Object execute(RequestWrapper request) {
		long id = Long.parseLong(request.getId());
		int vote = request.getVote();
		getCommentDao().vote(id, vote);
		return "success";
	}

	@Override
	protected JSONObject resultToJson(Object object) throws JSONException {
		return getSuccessMessage("addVoteResult", object);
	}

}
